Encoding:

P32A

001000

rt

rs

sa

PRECR_SRA.PH.W

0

1111001

101

P32A

001000

rt

rs

sa

PRECR_SRA_R.PH.W

1

1111001

101

6

5

5

5

1

7

3

Format:

PRECR_SRA[_R].PH.W 

Precision Reduce Two Integer Words to Halfwords after a Right Shift

PRECR_SRA.PH.W    rt, rs, sa

DSP-R2

Precision Reduce Two Integer Words to Halfwords after a Right Shift

PRECR_SRA_R.PH.W   rt, rs, sa

DSP-R2

Precision Reduce Two Integer Words to Halfwords after a Right Shift

Purpose:

Precision Reduce Two Integer Words to Halfwords after a Right Shift

Do an arithmetic right shift of two integer words with optional rounding, and then reduce the precision to halfwords.

Description:

rt = (round(rt>>shift))15..0 || (round(rs>>shift))15..0

The two words in registers rs and rt are right shifted arithmetically by the specified shift amount sa to create interim results. The 16 least-significant bits of each interim result are then written to the corresponding elements of destination register rt.

In the rounding version of the instruction, a value of 1 is added at the most-significant discarded bit position after the shift is performed. The 16 least-significant bits of each interim result are then written to the corresponding elements of destination register rt.

The shift amount sa is interpreted as a five-bit unsigned integer taking values between 0 and 31.

This instruction does not write any bits of the ouflag field in the DSPControl register.

Restrictions:

No data-dependent exceptions are possible.

The operands must be a value in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

PRECR_SRA.PH.W
   ValidateAccessToDSP2Resources()
   if (sa4..0 = 0) then
      tempB15..0 = GPR[rt]15..0
      tempA15..0 = GPR[rs]15..0
   else
      tempB15..0 = ( (GPR[rt]31)sa || GPR[rt]31..sa )
      tempA15..0 = ( (GPR[rs]31)sa || GPR[rs]31..sa )
   endif
   GPR[rt]31..0 = tempB15..0 || tempA15..0
PRECR_SRA_R.PH.W
   ValidateAccessToDSP2Resources()
   if (sa4..0 = 0) then
      tempB16..0 = ( GPR[rt]15..0 || 0 )
      tempA16..0 = ( GPR[rs]15..0 || 0 )
   else
      tempB32..0 = ( (GPR[rt]31)sa || GPR[rt]31..sa-1 ) + 1
      tempA32..0 = ( (GPR[rs]31)sa || GPR[rs]31..sa-1 ) + 1
   GPR[rt]31..0 = tempB16..1 || tempA16..1

Exceptions:

Reserved Instruction, DSP Disabled